home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol A-4
/
(Vol A-4) Vol. A4.iso
/
Games
/
selfstorage.swf
/
scripts
/
frame_5
/
PlaceObject2_184_456
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
< prev
next >
Wrap
Text File
|
2008-03-17
|
19KB
|
473 lines
onClipEvent(enterFrame){
if(_root.int_spiellaeuft == 1)
{
if(int_aktiviert == 1)
{
int_soundwartecounter--;
int_aufschlag = 0;
if(dragging == 0)
{
v_y += 2 * g;
this._y += v_y;
if(this._y > _root.mc_box0._y + 100)
{
if(_root.int_soundon == 1)
{
_root.mc_sounds.crash.start(0,1);
}
if(_root.int_boxennummer == this.int_boxennummer)
{
_root.int_boxennummer = _root.int_boxennummer + 1;
_root.mc_box.duplicateMovieClip("mc_box" + _root.int_boxennummer,_root.int_boxennummer);
_root["mc_box" + _root.int_boxennummer].int_boxennummer = _root.int_boxennummer;
_root["mc_box" + _root.int_boxennummer].int_aktiviert = 0;
_root["mc_box" + _root.int_boxennummer]._y = 160;
_root["mc_box" + _root.int_boxennummer]._x = buehnenbreite + 100;
_root["mc_box" + _root.int_boxennummer].int_nr_box = _root.int_boxennummer;
_root["mc_box" + _root.int_boxennummer]._rotation = 0;
}
var arr_liegereihenfolge_zwischenspeicher = new Array();
ar = 0;
while(ar < _root.arr_liegereihenfolge.length)
{
if(int(_root.arr_liegereihenfolge[ar]) != int_nr_box)
{
arr_liegereihenfolge_zwischenspeicher.push(_root.arr_liegereihenfolge[ar]);
}
ar++;
}
_root.arr_liegereihenfolge = arr_liegereihenfolge_zwischenspeicher;
this.removeMovieClip();
}
this._x += v_x;
if(v_y > 0)
{
v_y -= lftw;
}
if(v_y < 0)
{
v_y += lftw;
}
if(v_y < lftw && v_y > - lftw)
{
v_y = 0;
}
if(v_x > 0)
{
v_x -= lftw;
}
if(v_x < 0)
{
v_x += lftw;
}
if(v_x < lftw && v_x > - lftw)
{
v_x = 0;
}
}
if(dragging == 1 && int_aufschlag == 0 && _root.int_boxennummer == this.int_boxennummer)
{
numb_lotabweichung = abweichungswinkel + startwinkel;
while(numb_lotabweichung > 180)
{
numb_lotabweichung -= 360;
}
while(numb_lotabweichung < -180)
{
numb_lotabweichung += 360;
}
numb_faktor_hebel = int(Math.sin(numb_lotabweichung * 3.141592653589793 / 180) * 100) / 100;
if(numb_lotabweichung < 0)
{
numb_faktor_hebel *= -1;
}
numb_rotationsbeschleunigung -= numb_lotabweichung / 5 * g * numb_faktor_hebel * (haltepunktdistanz / 100);
}
if(numb_rotationsbeschleunigung > 0)
{
numb_rotationsbeschleunigung -= lftw;
}
if(numb_rotationsbeschleunigung < 0)
{
numb_rotationsbeschleunigung += lftw;
}
if(dragging == 1 && _root.int_boxennummer == this.int_boxennummer)
{
numb_faktor_haltepunktdistanz = haltepunktdistanz / (this._width / 2);
if(numb_lotabweichung != 0 && numb_lotabweichung != 180)
{
v_x_faktor = numb_faktor_haltepunktdistanz * (int(v_x * Math.cos(numb_lotabweichung * 3.141592653589793 / 180)) / 5);
if(v_x_faktor < 0)
{
v_x_faktor = v_x_faktor * v_x_faktor * -1;
}
else
{
v_x_faktor *= v_x_faktor;
}
if(v_x_faktor < 10 && v_x_faktor > -10)
{
numb_rotationsbeschleunigung += v_x_faktor;
}
}
if(numb_lotabweichung != 90 && numb_lotabweichung != -90)
{
v_y_faktor = numb_faktor_haltepunktdistanz * (int(v_y * Math.cos((numb_lotabweichung - 90) * 3.141592653589793 / 180)) / 5);
if(v_y_faktor < 0)
{
v_x_faktor = v_y_faktor * v_y_faktor * -1;
}
else
{
v_y_faktor *= v_y_faktor;
}
if(v_y_faktor < 10 && v_y_faktor > -10)
{
numb_rotationsbeschleunigung += v_y_faktor;
}
}
}
if(int_objektliegt == 0 || _root.int_boxennummer != this.int_boxennummer)
{
startwinkel += numb_rotationsbeschleunigung;
if(int_sturzrotation == 0)
{
this._rotation = startwinkel + objektrotation;
}
}
if(this._y > buehnenhoehe - this._height / 2)
{
if(objektrotation > 0)
{
this._rotation -= 0;
}
if(objektrotation < 0)
{
this._rotation += 0;
}
}
if(dragging == 1 && _root.int_boxennummer == this.int_boxennummer)
{
int_objektliegt = 0;
v_y = this._y - ypos_save;
ypos_save = this._y;
v_x = this._x - xpos_save;
xpos_save = this._x;
xversatz = mausx * Math.sin((this._rotation + haltepunktwinkel) * 3.141592653589793 / 180);
yversatz = mausy * Math.cos((this._rotation - haltepunktwinkel + 90) * 3.141592653589793 / 180);
this._x = _root._xmouse - mausx;
this._y = _root._ymouse - mausy;
this._x = this._x + mausx + (- haltepunktdistanz) * Math.sin((this._rotation + haltepunktwinkel) * 3.141592653589793 / 180);
this._y = this._y + mausy - (- haltepunktdistanz) * Math.sin((this._rotation + haltepunktwinkel + 90) * 3.141592653589793 / 180);
if(this._y > buehnenhoehe - this._height / 2)
{
this._y = buehnenhoehe - this._height / 2;
int_haltepunktgesetzt = 0;
mausx = this._xmouse;
mausy = this._ymouse;
trace("\n\nMausX: " + mausx + "\nMausY: " + mausy);
vTan = Number(mausx) / Number(mausy);
arkusTanB = Math.atan(vTan);
haltepunktwinkel = (- arkusTanB / 3.141592653589793) * 180;
if(mausy >= 0)
{
if(mausx > 0)
{
haltepunktwinkel += 180;
}
else
{
haltepunktwinkel -= 180;
}
}
trace("haltepunktwinkel: " + haltepunktwinkel);
haltepunktdistanz = Math.sqrt(mausx * mausx + mausy * mausy);
objektrotation = this._rotation;
startwinkel = 0;
abweichungswinkel = haltepunktwinkel + this._rotation;
if(abweichungswinkel > 180)
{
abweichungswinkel -= 360;
}
if(abweichungswinkel < -180)
{
abweichungswinkel += 360;
}
trace("abweichungswinkel: " + abweichungswinkel);
}
}
int_boxenhit = 0;
j = 0;
while(j < int_boxennummer)
{
if(this.hitTest(_root["mc_box" + j]) && int_sturzrotation == 0)
{
if(_root.int_soundon == 1 && int_objektliegt == 0 && int_soundwartecounter <= 0)
{
_root.mc_sounds.schritt.start(0,1);
int_soundwartecounter = 5;
}
_root["mc_box" + j].numb_tiefsterpunkt = 0;
n = 1;
while(n <= 4)
{
if(_root["mc_box" + j]["mc_ecke" + n]._y > _root["mc_box" + j].numb_tiefsterpunkt)
{
_root["mc_box" + j].numb_tiefsterpunkt = _root["mc_box" + j]["mc_ecke" + n]._y;
}
n++;
}
_root["mc_box" + j].numb_hoechsterpunkt = 0;
n = 1;
while(n <= 4)
{
if(_root["mc_box" + j]["mc_ecke" + n]._y < _root["mc_box" + j].numb_hoechsterpunkt)
{
_root["mc_box" + j].numb_hoechsterpunkt = _root["mc_box" + j]["mc_ecke" + n]._y;
}
n++;
}
_root["mc_box" + j].numb_rechterpunkt = 0;
n = 1;
while(n <= 4)
{
if(_root["mc_box" + j]["mc_ecke" + n]._x > _root["mc_box" + j].numb_rechterpunkt)
{
_root["mc_box" + j].numb_rechterpunkt = _root["mc_box" + j]["mc_ecke" + n]._x;
}
n++;
}
_root["mc_box" + j].numb_linkerpunkt = 0;
n = 1;
while(n <= 4)
{
if(_root["mc_box" + j]["mc_ecke" + n]._x < _root["mc_box" + j].numb_linkerpunkt)
{
_root["mc_box" + j].numb_linkerpunkt = _root["mc_box" + j]["mc_ecke" + n]._x;
}
n++;
}
numb_tiefsterpunkt = 0;
i = 1;
while(i <= 4)
{
if(this["ecke" + i + "Y"] > numb_tiefsterpunkt)
{
numb_tiefsterpunkt = this["ecke" + i + "Y"];
int_tiefsteecke = i;
}
i++;
}
numb_tiefsterpunkt2 = 0;
i = 1;
while(i <= 4)
{
if(this["ecke" + i + "Y"] > numb_tiefsterpunkt2 && i != int_tiefsteecke)
{
numb_zweittiefsterpunkt = this["ecke" + i + "Y"];
int_zweittiefsteecke = i;
}
i++;
}
if(this._y + numb_tiefsterpunkt - 2 - 2 * v_y < _root["mc_box" + j]._y + _root["mc_box" + j].numb_hoechsterpunkt)
{
var_hit_richtung = "oben";
}
else if(_root["mc_box" + j]._x + _root["mc_box" + j].numb_linkerpunkt > this._x)
{
var_hit_richtung = "links";
}
else
{
var_hit_richtung = "rechts";
}
if(var_hit_richtung == "links" || var_hit_richtung == "rechts")
{
trace("HIT: " + var_hit_richtung);
dragging = 0;
this._x += v_x;
_root["mc_box" + j].v_x = v_x;
if(_root.int_boxennummer == this.int_boxennummer && int_boxenhit == 0 && int_seitenhit == 0)
{
this.v_x = v_x * -1;
int_boxenhit = 1;
int_seitenhit = 1;
}
}
if(var_hit_richtung == "oben")
{
dragging = 0;
if(int_boxenhit == 0)
{
this._y -= v_y;
int_boxenhit = 1;
}
_root["mc_box" + j].v_x = v_x / reibung;
int_getroffenebox_nummer = j;
}
}
j++;
}
if(int_boxenhit == 1 && var_hit_richtung == "oben")
{
v_y = v_y * -1 / elastizitaet;
v_x /= reibung;
int_aufschlag = 1;
i = 1;
while(i <= 4)
{
numb_eckdistanz = Math.sqrt(this["mc_ecke" + i]._x * this["mc_ecke" + i]._x + this["mc_ecke" + i]._y * this["mc_ecke" + i]._y);
vTan = Number(this["mc_ecke" + i]._x) / Number(this["mc_ecke" + i]._y);
arkusTanB = Math.atan(vTan);
numb_eckwinkel = (- arkusTanB / 3.141592653589793) * 180;
if(this["mc_ecke" + i]._y >= 0)
{
if(this["mc_ecke" + i]._x > 0)
{
numb_eckwinkel += 180;
}
else
{
numb_eckwinkel -= 180;
}
}
this["ecke" + i + "X"] = numb_eckdistanz * Math.sin((this._rotation + numb_eckwinkel) * 3.141592653589793 / 180);
this["ecke" + i + "Y"] = numb_eckdistanz * Math.sin((this._rotation - 90 + numb_eckwinkel) * 3.141592653589793 / 180);
i++;
}
numb_tiefsterpunkt = 0;
i = 1;
while(i <= 4)
{
if(this["ecke" + i + "Y"] > numb_tiefsterpunkt)
{
numb_tiefsterpunkt = this["ecke" + i + "Y"];
int_tiefsteecke = i;
}
i++;
}
numb_tiefsterpunkt2 = 0;
i = 1;
while(i <= 4)
{
if(this["ecke" + i + "Y"] > numb_tiefsterpunkt2 && i != int_tiefsteecke)
{
numb_zweittiefsterpunkt = this["ecke" + i + "Y"];
int_zweittiefsteecke = i;
}
i++;
}
if(_root.int_boxennummer == this.int_boxennummer)
{
_root.mc_schwerpunktlinie._x = this._x;
if(_root.mc_schwerpunktlinie.hitTest(_root["mc_box" + int_getroffenebox_nummer]))
{
int_absturz = 0;
}
else
{
int_absturz = 1;
if(_root.mc_schwerpunktlinie._x < _root["mc_box" + int_getroffenebox_nummer]._x)
{
numb_rotationsbeschleunigung += (_root.mc_schwerpunktlinie._x - (_root["mc_box" + int_getroffenebox_nummer]._x - _root["mc_box" + int_getroffenebox_nummer]._width / 2)) / 10;
v_x += (_root.mc_schwerpunktlinie._x - (_root["mc_box" + int_getroffenebox_nummer]._x - _root["mc_box" + int_getroffenebox_nummer]._width / 2)) / 10;
_root["mc_box" + int_getroffenebox_nummer].v_x = v_x / reibung * -1;
}
else
{
numb_rotationsbeschleunigung += (_root.mc_schwerpunktlinie._x - (_root["mc_box" + int_getroffenebox_nummer]._x + _root["mc_box" + int_getroffenebox_nummer]._width / 2)) / 10;
v_x += (_root.mc_schwerpunktlinie._x - (_root["mc_box" + int_getroffenebox_nummer]._x + _root["mc_box" + int_getroffenebox_nummer]._width / 2)) / 10;
_root["mc_box" + int_getroffenebox_nummer].v_x = v_x / reibung * -1;
}
trace("Absturz");
}
}
if(int_absturz == 0)
{
aufschlag_dreh_faktor = this["ecke" + int_tiefsteecke + "X"] * 2 / (this._width / 2);
numb_rotationsbeschleunigung = (v_y / 5 - 0.5) * numb_gewicht * aufschlag_dreh_faktor;
if(numb_tiefsterpunkt - numb_zweittiefsterpunkt < 20 && v_y > -1.5 && v_y < 0.5)
{
numb_rotationsbeschleunigung /= 2;
}
if(numb_tiefsterpunkt - numb_zweittiefsterpunkt < 10 && v_y > -1.5 && v_y < 0.5)
{
numb_rotationsbeschleunigung /= 2;
}
if(numb_tiefsterpunkt - numb_zweittiefsterpunkt < 4 && v_y > -1.5 && v_y < 0.5)
{
int_objektliegt = 1;
if(int_sturzrotation == 0)
{
if(this._rotation > -10 && this._rotation < 10)
{
this._rotation = 0;
}
if(this._rotation > -100 && this._rotation < -80)
{
this._rotation = -90;
}
if(this._rotation > 80 && this._rotation < 100)
{
this._rotation = 90;
}
if(this._rotation > 170 || this._rotation < -170)
{
this._rotation = 180;
}
}
if(_root.int_boxennummer == this.int_boxennummer)
{
_root.numb_maxhoehe = 0;
b = 1;
while(b <= _root.int_boxennummer)
{
if(_root.mc_box0._y - _root["mc_box" + b]._y > _root.numb_maxhoehe)
{
_root.numb_maxhoehe = _root.mc_box0._y - _root["mc_box" + b]._y;
_root.numb_hoeheimbildY = _root["mc_box" + b]._y;
}
b++;
}
trace("Max Hoehe: " + _root.numb_maxhoehe);
trace("Hoehe im Bild: " + _root.numb_hoeheimbildY);
}
if(_root.int_boxennummer == this.int_boxennummer)
{
_root.arr_liegereihenfolge.push(int_nr_box);
trace(_root.arr_liegereihenfolge);
_root.int_boxennummer = _root.int_boxennummer + 1;
_root.mc_box.duplicateMovieClip("mc_box" + _root.int_boxennummer,_root.int_boxennummer);
_root["mc_box" + _root.int_boxennummer].int_boxennummer = _root.int_boxennummer;
_root["mc_box" + _root.int_boxennummer].int_aktiviert = 0;
_root["mc_box" + _root.int_boxennummer]._y = 160;
_root["mc_box" + _root.int_boxennummer]._x = buehnenbreite + 100;
_root["mc_box" + _root.int_boxennummer].int_nr_box = _root.int_boxennummer;
_root["mc_box" + _root.int_boxennummer]._rotation = 0;
}
}
}
}
if(dragging == 1)
{
if(int_haltepunktgesetzt == 0)
{
int_haltepunktgesetzt = 1;
}
_parent.mc_haltepunkt._x = _parent._xmouse;
_parent.mc_haltepunkt._y = _parent._ymouse;
}
else
{
int_haltepunktgesetzt = 0;
}
}
}
if(this.int_aktiviert == 0 && _root.int_boxennummer == this.int_boxennummer && this._x > buehnenbreite - 80)
{
this._x -= 8;
this._y = 200 - this._height / 2;
_root.mc_foerderband.play();
}
}